<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
 </head>
 <body>
  
 </body>
</html>
<script>
	//全局变量
	var a = 123;
	//作用域链, 首先它会在当前环境下去找对应的标识符，有就停止，
	//没有就继续往外找直到找到全局标识
	function outer(){
		//var a = 100;
		inner();
		function inner(){
			//var a = 200;
			console.log(a);
		};
	};

	outer();

	function fn(){
		b = 12; //不写var就变成了全局变量，所以函数体以外也能调用到这个b
		console.log(b);
	};
	fn();
	console.log(b);
</script>
